import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;


public class LiczbaTest2 {
	
	static Liczba test;
	
	@Before
	public static void setUpBeforeClass() throws Exception {
		test = new Liczba(6);
	}

	@After
	public static void tearDownAfterClass() throws Exception {
		test = null;
	}
	
	@Test
	public void testZapis() throws Wyjatki {
		
		assertNotNull ("test not null", test);
	}
	
	@Test
	public void testZapis2() throws Wyjatki {
		assertFalse ("(12)4 = 6", "12".compareTo(test.zapis(4)) != 0);
	}
	
	@Ignore
	@Test
	public void testZapisBool() throws Wyjatki {
		assertTrue ("(12)4 = 6", "12".compareTo(test.zapis(4)) == 0);
	}
	
	@Test (timeout = 100)
	public void testZapisEquals() throws Wyjatki {
		assertEquals ("(20)3 = 6", "20", test.zapis(3));
		assertEquals ("(12)4 = 6", "12", test.zapis(4));
		assertEquals ("(11)5 = 6", "11", test.zapis(5));
		assertEquals ("(6)15 = 6", "6", test.zapis(15));
	}
	
	@Test
	public void testZapisExceptions() throws Wyjatki {

		try { test.zapis(-2); fail ("Oczekiwano wyjatku");}
		catch (Wyjatki ex){}
		
		try { test.zapis(34); fail ("Oczekiwano wyjatku");}
		catch (Wyjatki ex){}
	}
	

}
